package com.example.demo.controller;

import com.example.demo.entity.commodity;
import com.example.demo.mapper.commodityMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@CrossOrigin
@RestController
public class commodityController {

    @Autowired
    commodityMapper commodityMapper;
        @GetMapping(path = "/selectcommodity")
    public List<commodity> selectcommodity(){

        return commodityMapper.select();
    }
    @GetMapping(path = "/selectcommodityByname/{name}")
    public  commodity selectcommodityByname(@PathVariable("name") String name){
            return commodityMapper.selectcommodityByname(name);
    }
    @GetMapping(path = "/mohuoselectcommodityByname/{name}")
    public  List<commodity> mohuoselectcommodityByname(@PathVariable("name") String name){
        return commodityMapper.mohuoselectcommodityByname(name);
    }
}
